package com.ruoyi.web.controller.market.special;

import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.db.domain.SpecialDataApiInfo;
import com.ruoyi.special.service.ISpecialDataApiInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.wapper.SpecialDataApiInfoWapper;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 机构api推送数据Controller
 * 
 * @author ruoyi
 * @date 2023-03-12
 */
@Controller
@RequestMapping("/special/apiData")
public class SpecialDataApiInfoController extends BaseController
{
    private String prefix = "special/apiData";

    @Autowired
    private ISpecialDataApiInfoService specialDataApiInfoService;

    @RequiresPermissions("special:data:view")
    @GetMapping("/item/{infoId}")
    public String apiData(@PathVariable("infoId")String infoId, ModelMap modelMap)
    {
        modelMap.put("infoId", infoId);
        return prefix + "/apiData";
    }

    /**
     * 查询机构api推送数据列表
     */
    @RequiresPermissions("special:data:view")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SpecialDataApiInfo specialDataApiInfo)
    {
        startPage();
        List<Map<String, Object>> mapList = specialDataApiInfoService.selectSpecialDataApiInfoListMap(specialDataApiInfo);
        mapList = new SpecialDataApiInfoWapper(mapList).wrap();
        return getDataTable(mapList);
    }

    @RequiresPermissions("special:data:view")
    @GetMapping("/view/{id}")
    public String view(@PathVariable("id") Long id, ModelMap mmap)
    {
        SpecialDataApiInfo specialDataApiInfo = specialDataApiInfoService.selectSpecialDataApiInfoById(id);
        mmap.put("specialDataApiInfo", specialDataApiInfo);
        return prefix + "/view";
    }

}
